import 'package:flutter/material.dart';

class MGroupSlot extends StatelessWidget {
  final Widget header;
  final Widget body;
  final Widget footer;
  final double padding;

  MGroupSlot({
    this.header,
    @required this.body,
    this.footer,
    this.padding = 10.0,
  }) : assert(body != null);

  @override
  Widget build(BuildContext context) {
    List<Widget> showWidgets = [];

    // header
    if (header != null) showWidgets.add(header);

    // body
    if (body != null) {
      showWidgets.add(
        padding == 0.0
            ? body
            : Padding(
                padding: EdgeInsets.only(left: padding, right: padding),
                child: body,
              ),
      );
    }

    // footer
    if (footer != null) showWidgets.add(footer);

    return Column(
      children: showWidgets,
    );
  }
}
